package cn.bopomo.dealer.uloo.action;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import cn.bopomo.dealer.base.action.BaseAction;
import cn.bopomo.dealer.uloo.common.UlooConstant;
import cn.bopomo.dealer.uloo.service.impl.UlooBackStageServiceImpl;

import com.vpn888.www.BpGuestbook;
import com.vpn888.www.BpVpnConsumeVO;


public class ShowVpnConsumeDetailAction extends BaseAction {

	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		//response.setContentType("text/html;charset=UTF-8");
		//response.setHeader("Cache-control","no-cache");
		//判断权限
		if (!this.hasPermission(request)){
			//error
			response.getWriter().write("errors:你没有权限进行该操作");
			return null;
		}
//		GregorianCalendar gg = new GregorianCalendar ();
//		//获取当前操作员ID
//		String userId = this.getUserId(request);
//		if(userId == null){
//			return this.findFailure(mapping);
//		}
		//获取参数
		String id = request.getParameter("id");
		//获取service
//		UlooBackStageServiceImpl service = (IOperatorService)this.findService(ServiceConfig.OPERATOR_SERVICE);
		UlooBackStageServiceImpl service = new UlooBackStageServiceImpl();
		//获取查询对象
		BpVpnConsumeVO bpVpnConsumeVO = service.showVpnConsumeDetail(Integer.parseInt(id));
		//设置对象并返回
		request.setAttribute(UlooConstant.KEY_VPN_CONSUME, bpVpnConsumeVO);
		return this.findSuccess(mapping);
	}
	
	protected boolean isValidateData(String regEx, String str){
		Pattern pattern= Pattern.compile(regEx);
		Matcher m=pattern.matcher(str); 
		return m.find();
	}
	
	public static void  main(String[] sa){
		//System.out.println(ca.isValidateData("=======System.out.println======="));
	}
}
